<?php 

namespace Home\Model;
use Think\Model;   
class RecruitModel extends Model{ 

	public function sousuo($perPage = 5){

		/*****************搜索***************/
		$where = array();
		
		
		
		$rname = I('get.rname');

		if($rname){

			$where['rname'] = array('like',"%$rname%");
		}


		$city = I('get.city');
		if($city){

			$where['city'] = array('like' ,"%$city%");
		}

		$expir = I('get.expir');
		if($expir){

			$where['expir'] = array('like',"%$expir%");
		}

		$edu = I('get.edu');
		if($edu){

			$where['edu'] = array('like',"%$edu%");
		}
		
		
		
		
			



		



		/*********翻页*********/
		$count = $this->count();
		$pageobj = new \Think\Page($count,$perPage);

		
		$pageobj->setConfig('next','下一页');	
		$pageobj->setConfig('prev','上一页');

		$pageString = $pageobj->show();

		/******排序*******/
		$id = "rid";
		$paixu = "desc";
		$odby = I('get.odby');
		if($odby){
			if($odby == "moren"){
				$paixu = "asc";
			}else{
				$paixu = "desc";
			}
		}	

		/*****查询****/	
		$data = $this->order("$id $paixu")->where($where)->limit($pageobj->firstRow.','.$pageobj->listRows)->select();

		//返回数据
		return array(
			'data'=> $data, 
			'page'=> $pageString, 
			);

		return $data;
}

}

